<?php
//查找商家数据库
$sql="select * from ".$BIAOTOU."mall where end_time >='".date('Y-m-d')."' order by sort desc limit 0,8";
$rs_mall=mysql_query($sql);

$sql="select * from ".$BIAOTOU."malltype order by sort asc limit 0,7";
$rs_malltype=mysql_query($sql);

$sql="select id,name,fan,catid from ".$BIAOTOU."mall where end_time >='".date('Y-m-d')."' order by sort desc";
$rs_malllist=mysql_query($sql);
$i=0;
while ($row2 = mysql_fetch_array($rs_malllist)){
	$allmalllist[$i]['id']= $row2['id'];
	$allmalllist[$i]['catid']= $row2['catid'];
	$allmalllist[$i]['name']= $row2['name'];
	$allmalllist[$i]['fan']= $row2['fan'];
	$allmalllist[$i]['catid']= $row2['catid'];
	$i++;
}

//幻灯片
$sql="select * from ".$BIAOTOU."slides where hide=0 order by wz asc limit 0,10";
$rs_slides=mysql_query($sql);
$i=0;
while ($row = mysql_fetch_array($rs_slides)){
	$slides_pic[$i]=$row['pic'];
	$slides_url[$i]=$row['url'];
	$slides_title[$i]=$row['title'];
	$i++;
}

//热门店铺
$sql="select * from ".$BIAOTOU."shop order by tuijian desc, id desc  limit 0,5";
$rs_shop=mysql_query($sql);

//常见问题
$sql="select * from ".$BIAOTOU."article where cid=3 order by ontop desc,created_date desc limit 0,10";
$rs_article=mysql_query($sql);

//图片资讯
$sql="select * from ".$BIAOTOU."article where pic<>'' and cid>3 order by ontop desc,created_date desc limit 0,2";
$rs_pic_article=mysql_query($sql);

//购物资讯
$sql="select * from ".$BIAOTOU."article where cid>3 order by ontop desc,created_date desc limit 0,5";
$rs_new_article=mysql_query($sql);

//站点公告
$sql="select * from ".$BIAOTOU."article where cid=2 order by ontop desc,created_date desc limit 0,4";
$rs_gg=mysql_query($sql);

//文字商城
$sql="select * from ".$BIAOTOU."mall order by sort desc limit 8,17";
$rs_mall2=mysql_query($sql);

//带图优惠促销
$sql="select id,name,pic from ".$BIAOTOU."activity where recommend=1 and pic<>'' order by sort desc, etime desc limit 2";
$pic_cuxiao=mysql_query($sql);

//文字优惠促销
/*$sql="select a.id,a.name,a.pic,a.mallid,b.name as mallname from ".$BIAOTOU."activity as a,".$BIAOTOU."mall as b where a.mallid=b.id and a.recommend=1 order by a.sort desc, a.etime desc limit 2,6";
$cuxiao=mysql_query($sql);
*/
//米粒快报
$sql="select * from ".$BIAOTOU."article where cid=4 order by ontop desc,created_date desc limit 0,6";
$cuxiao=mysql_query($sql);



//积分兑换
$sql="select * from ".$BIAOTOU."dhlist where recommend=1 and hide=0 order by sort desc, addtime desc limit 8";
$duihuan=mysql_query($sql);

//团购商品
$sql="select a.id,a.title,a.image,a.price,a.value,b.name,b.fan from ".$BIAOTOU."tuan_goods as a,".$BIAOTOU."mall as b where a.mall_id=b.id order by a.top desc,a.sort desc, endTime desc limit 5";
$tuan_goods=mysql_query($sql);

//热门分享
$sql="select image,title,id,sort,ddusername,dduserid from ".$BIAOTOU."shai order by sort desc ,id desc limit 6";
$shai_list=mysql_query($sql);
//$shai_list=$query;
/*while($row=mysql_fetch_array($query)){
    $shai[]=$row;
}*/


//合作伙伴
$sql="select * from ".$BIAOTOU."yqlj where leibie=1 and pic<>'' order by wz desc";
$rs_hzhb=mysql_query($sql);

$Taoapi_Config = Taoapi_Config::Init();
$Taoapi_Config->setCharset('UTF-8');
$Taoapi = new Taoapi;
//热销
$Taoapi->method = 'taobao.taobaoke.items.get';
$Taoapi->fields = 'iid,num_iid,title,nick,pic_url,price,click_url,shop_click_url,volume,commission,commission_rate,commission_num,commission_volume,';
$Taoapi->nick = MYUSERNICK;
$Taoapi->keyword = HOTWORD;
$Taoapi->page_size = '4';
$Taoapi->sort = 'commissionNum_desc';
$Taoapi->outer_code=$_SESSION["dduserid"];
$rexiaoapi= $Taoapi->Send('get','xml')->getArrayData();
$ListHot = $rexiaoapi["taobaoke_items"]["taobaoke_item"]; 
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="html" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta name="author" content="duoduo123.com-120205" />
<?php include(DDROOTPATH.'/cache/title/'.$pagetag.'_title.php');?>
<link  href="template/<?=MOBAN?>/css/layout.css" rel="stylesheet" type="text/css" />
<link href="template/<?=MOBAN?>/css/style.css" rel="stylesheet" type="text/css"/>
<link href="template/<?=MOBAN?>/css/mystyle.css" rel="stylesheet" type="text/css"/>
<link href="template/<?=MOBAN?>/css/comm.css" rel="stylesheet" type="text/css"/>
<link href="template/<?=MOBAN?>/css/main.css" rel="stylesheet" type="text/css"/>

<script type="text/javascript" src="template/<?=MOBAN?>/js/jquery-1.3.2.min.js"></script>
<SCRIPT type="text/javascript" src="template/<?=MOBAN?>/js/base64.js"></SCRIPT>
<SCRIPT type="text/javascript" src="template/<?=MOBAN?>/js/function.js"></SCRIPT>
<SCRIPT type="text/javascript" src="template/<?=MOBAN?>/js/taobao.js"></SCRIPT>
<SCRIPT type="text/javascript" src="template/<?=MOBAN?>/js/focus.js"></SCRIPT>
<style type="text/css">
body{behavior:url(template/<?=MOBAN?>/js/csshover.htc);}   /*注意路径*/
</style>

<script type="text/javascript">
function ddMouseIn(id)
{
 /*鼠标进入 所有的都要恢复 只有当前的选中*/
 for(i=1;i<=6;i++)
 {
	 document.getElementById("dd_"+i).className="up";
	 document.getElementById("uimg_"+i).className="userimgup";
 }
document.getElementById("dd_"+id).className="hot";
document.getElementById("uimg_"+id).className="userimgnot";
}

function ddMouseOut()
{
 /*鼠标进入 所有的都要恢复 只有当前的选中*/
 for(i=1;i<=6;i++)
 {
	 document.getElementById("dd_"+i).className="up";
	 document.getElementById("uimg_"+i).className="userimgup";
 }
document.getElementById("dd_1").className="hot";
document.getElementById("uimg_1").className="userimgnot";
}
</script>

</head>
<body>
<?php
include("header.tpl.php");
?>
<div class="main_top">
  <div class="bleft"></div>
  <!--幻灯-->
  <div class="center">
	<div class="sub_box">
	 <div id="p-select" class="sub_nav">
		<div class="sub_no" id="bd1lfsj">
	    	<ul>
		      <?php
			   foreach($slides_url as $k=>$v)
			   {
				   echo "<li class=>".($k+1)."</li>";
				}
			  ?>
			</ul>
		</div>
	 </div>
	 <div id="bd1lfimg"><div>
	   <dl class="show"></dl>
       <?php
	   foreach($slides_url as $k=>$v)
       {
		 echo "<dl class=>";
	     echo "<dt><a href=".$slides_url[$k]." target=_blank><img src=upload/".$slides_pic[$k]." alt=".$slides_title[$k]."  width=497 height=306 /></a></dt>";
		 echo "</dl>";
        }
		?>	   
	  </div>
	 </div>
    </div>
      <script type="text/javascript">movec();</script>
  </div> 
 
  <div class="right">
    <div class="fm"><img src="template/<?=MOBAN?>/images/login.png" width="263" height="67" border="0" /></div>
    <div class="fm" style="margin-top:5px"><img src="template/<?=MOBAN?>/images/shopping.png" width="263" height="67" border="0" /></div>
    <div class="fm" style="margin-top:5px"><img src="template/<?=MOBAN?>/images/getmi.png" width="263" height="67" border="0" /></div>
    <div class="fm" style="margin-top:5px;border:0;height:71px"><img src="template/<?=MOBAN?>/images/duihuan.png" width="263" height="71" border="0" /></div>
  </div>
</div>

<div class="main_center">
  <div class="left">
  	<div class="form">
      <div class="t1">
      	<div class="lt">
            <a href="#" class="active">推荐店铺</a>
            <a href="malllist.php">返米店铺</a>
            <a href="shoplist.php">淘宝店铺</a>
            <a href="#">米票店铺</a>
            <a href="#">订单店铺</a>
        </div>
        <div class="rt"><a href="malllist.php" class="tesu">全部店铺&gt;&gt;</a></div>
      </div>
      <form class="box" name="formname" target="_blank" method="get" action="<?=$navheadurl?>view.php" style="float:left; ">
       <input type="hidden" name="search" value="1" />
      <div class="t2">
      	<div class="ef"><input name="q" onfocus="this.value='';" type="text" id="s-txt" class="s-txt" value="输入您想要的淘宝商品网址" /></div>
        <div class="b"><input type="submit" name="" class='button' value='淘宝返米' style='' /></div>
      </div>
      </form>
      <div class="mallfm">
      <?php
	  $i=1;
	  while ($row = mysql_fetch_array($rs_mall)) 
	  {
		  if(($i==1)||($i==5))
		  {
			echo "<div class=box>";
			echo "<div class=pic><a href=mall".$url_head_id.$row['id'].$url_end." target=_blank><img src=".$row['logo']." width=98 height=47 border=0 /></a></div>";
			echo "<div class=title><a href=mall".$url_head_id.$row['id'].$url_end." target=_blank>".$row['name']."</a></div>";
			echo "<div class=fanxian>最高返".$row['fan']."米</div>";
			echo "</div>";
		  }
		  else
		  {
			echo "<div class=box style=margin-left:52px>";
			echo "<div class=pic><a href=mall".$url_head_id.$row['id'].$url_end." target=_blank><img src=".$row['logo']." width=98 height=47 border=0 /></a></div>";
			echo "<div class=title><a href=mall".$url_head_id.$row['id'].$url_end." target=_blank>".$row['name']."</a></div>";
			echo "<div class=fanxian>最高返".$row['fan']."米</div>";
			echo "</div>";
		   }
		   $i++;
	  }
	  ?>
      </div>
    </div>
  	<div class="form" style="margin-top:8px">
      <div class="t1">
       	<a href="#" class="active">用米兑换</a>
       	<a href="#">用米提现</a>
      </div>
      <div class="dhfm">
      <?php
	  $i=1;
	   while ($row = mysql_fetch_array($duihuan))
	  {
		  if(($i==1)||($i==5))
		  {
			echo "<div class=box>";
			echo "<div class=pic><a href=huangou".$url_head_id.$row['id'].$url_end." target=_blank><img src=".$row['pic']." alt=".$row['name']." border=0 style=width:127px; height:113px /></a></div>";
			echo "<div class=title><a href=huangou".$url_head_id.$row['id'].$url_end." target=_blank>".$row['name']."</a></div>";
			echo "<div class=jiage>".($row['money']*100)."米</div>";
			echo "</div>";
		  }
		  else
		  {
			echo "<div class=box style=margin-left:52px>";
			echo "<div class=pic><a href=huangou".$url_head_id.$row['id'].$url_end." target=_blank><img src=".$row['pic']." alt=".$row['name']." border=0 style=width:127px; height:113px /></a></div>";
			echo "<div class=title><a href=huangou".$url_head_id.$row['id'].$url_end." target=_blank>".$row['name']."</a></div>";
			echo "<div class=jiage>".($row['money']*100)."米</div>";
			echo "</div>";  
    	  }
		  $i++;
 	  }
	  ?>
      </div>
    </div>   
  </div> 
  
  <div class="right">
  	<div class="form">
    	<div class="t1">
         <div class="ef"><input type="text" name="" value="请输入米粒串号"  onfocus="this.value='';" class="estyle" /></div>
        </div>
        <div class="t2">
         <div class="item1"><a href="#">什么是米票</a></div>
         <div class="item1"><a href="#">怎么获取米票</a></div>
         <div class="bnt"><input type="submit" name="b_dhmp" value="米票兑换" class="button" /></div>
        </div>
    </div>
    <div class="form1">
	  <div class="title"><h1>优米库公告</h1></div> 
      <div class="list">
      	<ul>
        <?php
		 while ($row = mysql_fetch_array($rs_gg)) 
		 {
          echo "<li><a href=read".$url_head_id.$row['id'].$url_end." target=_blank>".$row['title']."</a></li>";
		 }
		?>     
        </ul>
      </div>   
	  <div class="title" style="margin-top:5px"><h1>米店快报</h1></div> 
      <div class="list">
      	<ul>
        <?php
		 while($row = mysql_fetch_array($cuxiao))
		 {
          echo "<li><a href=read".$url_head_id.$row['id'].$url_end." target=_blank>".$row['title']."</a></li>";
		 }
		?>     
        </ul>
      </div> 
      <div class="ad"><?=AD(2);?></div>
      <div class="title" style="margin-top:8px"><h1>米粒晒吧</h1></div>
      <div class="list1">
        <dl class='notice tieba'>
        <?php
		  $ic=1;
		  while($row=mysql_fetch_array($shai_list)){?>
		 <dd id="dd_<?=$ic?>" onmousemove="ddMouseIn(<?=$ic?>)" onmouseout="ddMouseOut();">
           <div class="text"><a href="baobei<?=$url_head_id.$row['id'].$url_end?>"><?=$row['title']?></a></div>
           <div class="userimgup" id="uimg_<?=$ic?>">
             <a href="userbao.php?id=<?=$row["dduserid"]?>"><img src="upload/avatar/<?=get_avatar_filepath($_SESSION['dduserid'], $size = 'big')?>" width=49 height=50 /></a>
             <span><a style="color:#cd0000" href="userbao.php?id=<?=$row["dduserid"]?>"><?=$row['ddusername']?></a></span>
           </div>
         </dd>
		<?php $ic++;}?>
		</dl>
      </div>
      <div class="bf"><div class="bnt"><input type="submit" name="b_shai" value="晒我喜欢的" class="button" onclick="window.open('baobeilist.php');" /></div></div>
    </div>
  </div>
</div>
<?php
	include("footer.tpl.php");
?>
<script type="text/javascript">ddMouseOut();</script>
</body>
</html>
